/*******************************************************************************
* @Filename      : bsp_wdg.h

* @Description   : bsp_wdg.h

* @Version       : 1.0.0

* @Date          : 2023.09.25
*******************************************************************************/

#ifndef __BSP_WDG_H
#define __BSP_WDG_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "bsp.h"

/* Exported types ------------------------------------------------------------*/

/* Exported define -----------------------------------------------------------*/
#define WDG_APP_Process() BSP_WDG_Reload()

/* Exported constants --------------------------------------------------------*/

/* Exported variables --------------------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
void BSP_WDG_Init(void);

INLINE void BSP_WDG_Reload(void)
{
    IWDG_ReloadCounter();
}

INLINE void BSP_WDG_Enable(void)
{
    IWDG_Enable();
}

INLINE void BSP_WDG_Sleep(void)
{
    RCC_LSICmd(DISABLE);
}

INLINE void BSP_WDG_Wakeup(void)
{
    RCC_LSICmd(ENABLE);
    while(RESET == RCC_GetFlagStatus(RCC_FLAG_LSIRDY));
}

#ifdef __cplusplus
}
#endif
#endif

/* End of File ---------------------------------------------------------------*/
